public class BinarySearchTree {
    public static class Node{
        public int key;
        public Node left;
        public Node right;

        public Node(int key) {
            this.key = key;
        }
    }

    public Node root;

    public boolean search(int key) {
        if(root.key == key) {
            return true;
        }
        Node cur = root;
        while(cur!=null) {
            if(cur.key<key) {
                cur = cur.right;
            }else if(cur.key>key){
                cur = cur.left;
            }else {
                return true;
            }
        }
        return false;
    }

    public boolean insert(int key) {
        if(root == null) {
            root = new Node(key);
            return true;
        }

        Node cur = root;
        Node prev = null;

        while(cur!=null) {
            prev = cur;
            if(cur.key<key) {
                
            }else if(cur.key>key) {

            }else {
                return false;
            }

        }
    }
}

















